package swingxrcp.framework.model.domain;

import java.util.Properties;

import swingxrcp.framework.util.StringUtils;


/**
 * SwingX框架启动属性配置
 *
 * @author Fengyiyun
 *
 */
public class Config extends AbstractResourceEntity {

	private Properties properties;

	public Config(Properties properties) {
		this.properties = properties;
	}

	/**
	 * 启动类(继承JXFrame)
	 *
	 * @return the startClass
	 */
	public String getStartClass() {
		return properties == null ? "" : StringUtils.toString(properties.get("start.class"));
	}

	/**
	 * 默认关闭窗口退出程序
	 *
	 * @return the defaultClose
	 */
	public boolean isDefaultClose() {
		return properties == null ? true : StringUtils.getBoolean(StringUtils.toString(properties.get("default.close")));
	}

	/**
	 * 窗体宽度
	 *
	 * @return the width
	 */
	public int getWidth() {
		return properties == null ? 800 : StringUtils.toInt(StringUtils.toString(properties.get("width")));
	}

	/**
	 * 窗体高度
	 *
	 * @return the height
	 */
	public int getHeight() {
		return properties == null ? 600 : StringUtils.toInt(StringUtils.toString(properties.get("height")));
	}

	/**
	 * 窗体标题
	 *
	 * @return the title
	 */
	public String getTitle() {
		return properties == null ? "" : StringUtils.toString(properties.get("title"));
	}

	/**
	 * 窗体置中
	 *
	 * @return the centering
	 */
	public boolean isCentering() {
		return properties == null ? false : StringUtils.getBoolean(StringUtils.toString(properties.get("centering")));
	}

	/**
	 * Logo图标
	 *
	 * @return the logo
	 */
	public String getLogo() {
		return properties == null ? "" : StringUtils.toString(properties.get("logo.icon"));
	}

	/**
	 * 窗体大小变化
	 *
	 * @return the resizable
	 */
	public boolean isResizable() {
		return properties == null ? false : StringUtils.getBoolean(StringUtils.toString(properties.get("resizable")));
	}

	/**
	 * 启动界面状态
	 *
	 * @return the splash
	 */
	public boolean isSplash() {
		return properties == null ? false : StringUtils.getBoolean(StringUtils.toString(properties.get("splash")));
	}

	/**
	 * 启动界面渐现
	 *
	 * @return the splashfadein
	 */
	public boolean isSplashfadein() {
		return properties == null ? false : StringUtils.getBoolean(StringUtils.toString(properties.get("splashfadein")));
	}

	/**
	 * 启动界面图片路径
	 *
	 * @return the splashIcon
	 */
	public String getSplashIcon() {
		return properties == null ? "" : StringUtils.toString(properties.get("splash.icon"));
	}

	/**
	 * 启动界面提示信息
	 *
	 * @return the splashInfo
	 */
	public String getSplashInfo() {
		return properties == null ? "" : StringUtils.toString(properties.get("splash.info"));
	}

	/**
	 * 数据源路径
	 *
	 * @return the dataSource
	 */
	public String getDataSource() {
		return properties == null ? "./workspace" : StringUtils.toString(properties.get("data.source"));
	}

	/**
	 * 校验数据模(文件名)
	 *
	 * @return the validatorModel
	 */
	public String getValidatorModel() {
		return properties == null ? "" : StringUtils.toString(properties.get("validator.model"));
	}
}
